﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IMedicare;
using EntityLibrary;

namespace Medicare
{
    public partial class FrmPosTran : Form
    {
        /// <summary>
        /// 交易金额
        /// </summary>
        public string TranMoney { get { return this.txtMoney.Text; } }

        #region 自定义变量

        private IMedicare.IMedicare medicare;
        #endregion
        public FrmPosTran()
        {
            InitializeComponent();


            PosChantEnity entity = new PosChantEnity();
            entity.MerchanCode = "03";
            entity.MerchanMoney = "";
            entity.POSFlowNo = DateTime.Now.ToString("MMddss");
            entity.CashMemberNo = "";
            entity.CashRegNo = "";
            entity.OrginTerminalNo = "";
            entity.AuthorizationNo = "";
            entity.OrginTranDT = "";
            entity.TerminalType = "7";
            entity.Track1 = "";
            entity.Track2 = "5226085710076865=49121200352600812761";
            entity.Track3 = "996226095710076865=1561560500050000001015812761214000049120=5710076865=000000000=00000000571000000000000";

            txtMoney.Text = IMedicare.IMedicareFactory.Instance.CreateInterface<SDRZDRInterface>().ShowBalance(entity);
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            PosChantEnity entity = new PosChantEnity();
            entity.MerchanCode = "01";
            entity.MerchanMoney = txtMoney.Text.Trim();
            entity.POSFlowNo = DateTime.Now.ToString("MMddss");
            entity.CashMemberNo = "";
            entity.CashRegNo = "";
            entity.OrginTerminalNo = "";
            entity.AuthorizationNo = "";
            entity.OrginTranDT = "";
            entity.TerminalType = "7";
            //entity.Track1 = "";
            //entity.Track2 = "5226085710076865=49121200352600812761";
            //entity.Track3 = "996226095710076865=1561560500050000001015812761214000049120=5710076865=000000000=00000000571000000000000";

            if (IMedicare.IMedicareFactory.Instance.CreateInterface<SDRZDRInterface>().CandTrans(entity).Success)
                MessageBox.Show("操作成功！");
            else
            {
                MessageBox.Show("操作失败！");
            }
        }
    }
}
